<template>
  <div id="jiaxiao">
    <div id="tittle">找驾校</div>
    <div id="lei">
      <city></city>
      <fenlei @biao="getbiao"></fenlei>
    </div>
    <div id="middle">
      <kuang :number="num" :coach="can"></kuang>
    </div>
    <div id="dibu">
      <div
        v-for="(name, i) in name"
        @click="dian(i)"
        :class="{ active: index == i }"
        :key="i"
      >
        {{ name }}
      </div>
    </div>
  </div>
</template>

<script>
import city from "../components/city.vue";
import fenlei from "../components/fenlei.vue";
import kuang from "../components/kuang.vue";
export default {
  name: "jiaxiao",
  data() {
    return {
      name: ["驾校", "教练", "做题"],
      index: 0,
      num: 10,
      can: "jiaxiao",
    };
  },
  components: {
    city,
    fenlei,
    kuang,
  },
  methods: {
    dian(i) {
      if (i == 0) {
        this.can = "jiaxiao";
      } else if (i == 1) {
        this.can = "coach";
      }
      // console.log(this.can);
      return (this.index = i);
    },
    getbiao(v) {
      this.num = v;
      console.log(this.num);
    },
  },
};
</script>

<style>
#jiaxiao {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
}
#tittle {
  width: 100vw;
  height: 5vh;
  background: rgb(29, 172, 249);
  font-size: 4vw;
  color: white;
  line-height: 5vh;
  position: fixed;
}
.active {
  color: brown;
}
#dibu {
  width: 100%;
  height: 8vh;
  background: rgb(179, 179, 179);
  position: fixed;
  bottom: 0;
  display: flex;
  justify-content: space-around;
}
#dibu > div {
  width: 30%;
  height: 100%;
  font-size: 4vw;
  line-height: 8vh;
}
#lei {
  padding-top: 5vh;
  background: white;
}
</style>
